package com.windward.vii.dao.mapper;

import com.windward.vii.dao.entity.AssetUserWithdraw;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface AssetUserWithdrawMapper {
    @Delete({
        "delete from asset_user_withdraw",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into asset_user_withdraw (id, sn, uid, ",
        "coin, ip, create_time, ",
        "update_time, status, ",
        "sys_uid, reason, org_id, ",
        "org_withdraw_sn)",
        "values (#{id,jdbcType=BIGINT}, #{sn,jdbcType=VARCHAR}, #{uid,jdbcType=BIGINT}, ",
        "#{coin,jdbcType=INTEGER}, #{ip,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=TINYINT}, ",
        "#{sysUid,jdbcType=BIGINT}, #{reason,jdbcType=VARCHAR}, #{orgId,jdbcType=BIGINT}, ",
        "#{orgWithdrawSn,jdbcType=VARCHAR})"
    })
    int insert(AssetUserWithdraw record);

    int insertSelective(AssetUserWithdraw record);

    @Select({
        "select",
        "id, sn, uid, coin, ip, create_time, update_time, status, sys_uid, reason, org_id, ",
        "org_withdraw_sn",
        "from asset_user_withdraw",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    AssetUserWithdraw selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(AssetUserWithdraw record);

    @Update({
        "update asset_user_withdraw",
        "set sn = #{sn,jdbcType=VARCHAR},",
          "uid = #{uid,jdbcType=BIGINT},",
          "coin = #{coin,jdbcType=INTEGER},",
          "ip = #{ip,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "status = #{status,jdbcType=TINYINT},",
          "sys_uid = #{sysUid,jdbcType=BIGINT},",
          "reason = #{reason,jdbcType=VARCHAR},",
          "org_id = #{orgId,jdbcType=BIGINT},",
          "org_withdraw_sn = #{orgWithdrawSn,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(AssetUserWithdraw record);
}